<?php #20070418 http://www.framework.altervista.org/FrameWork/applications/_codepress.inc
/************************************************************************/
/* FrameWork  test preview                                              */
/* ==================================================================== */
/*                                                                      */
/* This program is free software. You can redistribute it and/or modify */
/* it under the terms of the GNU General Public License as published by */
/* the Free Software Foundation; either version 2 of the License.       */
/************************************************************************/
//                                                                      */
/* Heditor Helene Syntax Highlighting Integrato in FrameWork            */
/*                                                                      */
/* Adattamento By: Daniele Deplano - Mail: nost@tiscali.it              */
//***********************************************************************/


structure_openBlock("table appl","FrameWork Code Editor","");
if (admin_isadmin()){

    // carica libemoticons e libBBcode se sono presenti
    loadlib("libBBcode");
    loadlib("libEmoticons");


    $file=$_GET['file'];
    $op=$_GET['op'];
    $data=stripslashes($_POST['myfile']);


    if ($op=="save"){
	$hf=fopen($file,"w");
	fwrite($hf,$data);
	fclose($hf);
	echo "file $file salvato:<br/> $data   <hr/>";
    }
}
?>
  <p>
    File:<b>[</b><?=$file?><b>]</b>
    <hr />

<form action="index.php?appname=_codepress.inc&op=save&file=<?=$file?>" method="post">
<?php if (file_exists("extras/codepress/codepress.php")){ ?>
    <input type='hidden' name='myfile' value=''>
    <iframe id="codepress" name="codepress" src="extras/codepress/codepress.php?action=edit&file=<?=$file;?>&language=php" width="100%" height="400"></iframe>
    <p align='right'><input type="submit" name="save" value="save code" onClick="myfile.value = CodePress.getCode();"></p>
<?php }else{ ?>
    <textarea name="myfile" width="100%" height="400" style="width: 100%; height:400;" ><?=join(file($file));?></textarea>
    <p align='right'><input type="submit" name="save" value="save code"></p>
<?php }?>
</form>

</p>
<?php structure_closeBlock(); ?>
